package com.zone.example.handler;

import com.zone.weixin4j.annotation.WxMessageHandler;
import com.zone.weixin4j.annotation.WxMessageInterceptor;
import com.zone.weixin4j.exception.WeixinException;
import com.zone.weixin4j.handler.WeixinMessageHandler;
import com.zone.weixin4j.qy.chat.WeixinChatMessage;
import com.zone.weixin4j.request.WeixinMessage;
import com.zone.weixin4j.request.WeixinRequest;
import com.zone.weixin4j.response.BlankResponse;
import com.zone.weixin4j.response.WeixinResponse;

import java.util.Set;

/**
 * WxMessageHandler 注解声明处理消息内容的类
 * WxMessageInterceptor  注解声明拦截消息内容的类
 */
@WxMessageHandler
public class ChatMessageHandler implements WeixinMessageHandler {

	public boolean canHandle(WeixinRequest request, WeixinMessage message,
			Set<String> nodeNames) throws WeixinException {
		return nodeNames.contains("PackageId");
	}

	public WeixinResponse doHandle(WeixinRequest request,
			WeixinMessage message, Set<String> nodeNames)
			throws WeixinException {
		WeixinChatMessage chatMessage = null; // 转换为实体
		return BlankResponse.global;
	}

	public int weight() {
		return 0;
	}
}
